package practice2;

import java.util.Arrays;
import java.util.Scanner;

public class P8681 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n=sc.nextInt();
        int depth = (int)Math.sqrt(n+1);        //有几层
        int[] arr = new int[400];
        Arrays.fill(arr,0);
        int max=0;
        int ans=0;
        for(int i=1;i<=n;i++){
            int a=sc.nextInt();
            int leval =(int)(Math.log(i)/Math.log(2))+1;
            arr[leval]+=a;
        }
        for(int i=1;i<=depth;i++){
            if(arr[i]>max){
                max=arr[i];
                ans=i;
            }
        }
        System.out.println(ans);
    }
}
